From 6cacaf3d151896fe4f3311689edbad553b87410d Mon Sep 17 00:00:00 2001 From: Morten Welinder Date: Wed, 17 Mar 2004 19:01:00 +0000 Subject: [PATCH] Plug some leaks and expose others. 2004-03-17 Morten Welinder * tests/testfilechooser.c (main): Plug some leaks and expose others. --- ChangeLog | 3 +++ ChangeLog.pre-2-10 | 3 +++ ChangeLog.pre-2-4 | 3 +++ ChangeLog.pre-2-6 | 3 +++ ChangeLog.pre-2-8 | 3 +++ tests/testfilechooser.c | 19 ++++++++++++++++++- 6 files changed, 33 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 4cc7143c54..13dfc5c350 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2004-03-17 Morten Welinder + * tests/testfilechooser.c (main): Plug some leaks and expose + others. + * tests/prop-editor.c (create_prop_editor): Don't leak the tooltip object. Fixed #136652. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 4cc7143c54..13dfc5c350 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,5 +1,8 @@ 2004-03-17 Morten Welinder + * tests/testfilechooser.c (main): Plug some leaks and expose + others. + * tests/prop-editor.c (create_prop_editor): Don't leak the tooltip object. Fixed #136652. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 4cc7143c54..13dfc5c350 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,5 +1,8 @@ 2004-03-17 Morten Welinder + * tests/testfilechooser.c (main): Plug some leaks and expose + others. + * tests/prop-editor.c (create_prop_editor): Don't leak the tooltip object. Fixed #136652. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 4cc7143c54..13dfc5c350 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,5 +1,8 @@ 2004-03-17 Morten Welinder + * tests/testfilechooser.c (main): Plug some leaks and expose + others. + * tests/prop-editor.c (create_prop_editor): Don't leak the tooltip object. Fixed #136652. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 4cc7143c54..13dfc5c350 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,5 +1,8 @@ 2004-03-17 Morten Welinder + * tests/testfilechooser.c (main): Plug some leaks and expose + others. + * tests/prop-editor.c (create_prop_editor): Don't leak the tooltip object. Fixed #136652. diff --git a/tests/testfilechooser.c b/tests/testfilechooser.c index 5c32627f88..863a11cd5a 100644 --- a/tests/testfilechooser.c +++ b/tests/testfilechooser.c @@ -368,6 +368,13 @@ set_filename_existing_nonexistent_cb (GtkButton *button, set_filename (chooser, "/usr/nonexistent"); } +static void +kill_dependent (GtkWindow *win, GtkObject *dep) +{ + gtk_object_destroy (dep); + g_object_unref (dep); +} + int main (int argc, char **argv) { @@ -530,8 +537,18 @@ main (int argc, char **argv) G_CALLBACK (set_filename_existing_nonexistent_cb), dialog); gtk_widget_show_all (control_window); - + + g_object_ref (control_window); + g_signal_connect (G_OBJECT (dialog), "destroy", + G_CALLBACK (kill_dependent), control_window); + + /* We need to hold a ref until we have destroyed the widgets, just in case + * someone else destroys them. We explicitly destroy windows to catch leaks. + */ + g_object_ref (dialog); gtk_main (); + gtk_widget_destroy (dialog); + g_object_unref (dialog); return 0; } -- 2.30.2